#!/bin/sh
# build-weib.ps1 [version]
# version 镜像版本，默认latest,指定版本号最后的tag名称为`v版本号`

tags='-t swr.cn-east-3.myhuaweicloud.com/erp4/crm:latest'
version='none'
if [ $1 ]; then
  version=$1
  tags="$tags -t swr.cn-east-3.myhuaweicloud.com/erp4/crm:$1"
fi

# 构建ui,更改npm源为本地源
docker build ./web/SourceCode/VUE --add-host mirrors.local.com:192.168.2.2 -t crm_ui:latest \
  --build-arg NPM_REGISTRY=http://mirrors.local.com/npm
  

echo $tags
docker build --add-host mirrors.local.com:192.168.2.2 --build-arg CRM_VERSION=$version $tags -f web/SourceCode/Dockerfile .